package HomeWork._2024_3_19.src;

public class Main {
    public static void main(String[] args) {
        C c = new C();
        c.setVariable3(3);
        System.out.println(c);
        if (c instanceof A) {
            A a = (A) c;
            a.setVariable1(1);
            System.out.println("可以转为A");
            System.out.println(a);
        } else {
            System.out.println("不能转为A");
        }
        if (c instanceof B) {
            B b = (B) c;
            b.setVariable2(2);
            System.out.println("可以转为B");
            System.out.println(b);
        } else {
            System.out.println("不能转为B");
        }
        if (c instanceof C) {
            C c1 = (C) c;
            c.setVariable3(33);
            System.out.println("可以转为C");
            System.out.println(c1);
        } else {
            System.out.println("不能转为C");
        }
    }
}
